/* _____________________________________________________________________________

	Project: The Effects of Independent Local Radio on Tanzanian Public Opinion: Evidence from a Planned Natural Experiment
	Authors: Donald P. Green, Dylan Groves, Constantine Manda, Beatrice Montano, Bardia Rahmani
	
	Purpose: Figure 3
	Date: 2022.10
________________________________________________________________________________*/


/* Introduction ________________________________________________________________*/
	
	clear all	
	set more off
	
/* Set Control Directory _______________________________________________________*/

	*global user "X:/Dropbox/Wellspring Tanzania Papers/Wellspring Tanzania - Natural Experiment/pfm_ne_replication"
		

/* INTERESTKNOWLEDGE ___________________________________________________________*/	

			/* define matrix */		

			import excel "${user}/pfm_ne_replication_rawoutput_main.xlsx", sheet(tA4_interestknowledge) firstrow clear

			destring lasso_coef l_lowb l_uppb, replace
			
			mkmat lasso_coef l_lowb l_uppb, mat(INTERESTKNOWLEDGE)
			matrix rownames INTERESTKNOWLEDGE = "Political Interest*** (control mean = 0.788)"					///
										"Knows Tanzanian Prime Minister by name (0.76)"			///
										"Knows Tanzanian Vice President by name (0.73)"			///
										"Knows Tanzanian Chief Justice by name (0.19)"				///
										"Knows position held by Donald Trump (0.56)"						///
										"Knows position held by Joe Biden (0.17)"						///
										"Knows position held by Uhuru Kenyatta (0.66)"					///
										"Knows about early marriage court ruling (0.08)"				///
										"Accepts personal protective equipment (0.13)"				///
										"Would encourage daughter to enter politics (0.69)"			///
										"Political participation index (0.59)"

			/* generate coeffplot */
		
			matselrc INTERESTKNOWLEDGE X_INTERESTKNOWLEDGE , row(1/11)

			coefplot 	matrix(X_INTERESTKNOWLEDGE[,1]), ///
														mcolor(black) ///
														ci((X_INTERESTKNOWLEDGE[,2] X_INTERESTKNOWLEDGE[,3] ))  ///
														ciopts(lcolor(black)) ///
														xline(0) ///
														xscale(r(-0.15(0.05)0.2)) ///
														xlab(-0.15(0.05)0.2) 				///
														graphregion(color(white)) ///
														bgcolor(white) xtitle("") ///
														ytitle("")  ///
														coeflabels(, notick labgap(-122))	///
														yscale(noline alt) ///
														graphregion(margin(l=60)) ///
														transform(* = min(max(@,-0.25),0.20)) ///
														legend(off) ///
														headings(	"Political Interest*** (control mean = 0.788)" = "{bf:Political Interest}" ///
																	"Knows Tanzanian Prime Minister by name (0.76)" = "{bf:Domestic Political Figures Knowledge}" ///
																	"Knows position held by Donald Trump (0.56)" = "{bf:Foreign Political Figures Knowledge}" ///	
																	"Knows about early marriage court ruling (0.08)" = "{bf:Current Events Knowledge}" ///
																	"Would encourage daughter to enter politics (0.69)" = "{bf:Political participation}", labgap(-122))  
														
														
					 graph export "${user}/f2_coefplot_interestknowledge_lasso.png", as(png) width(3500) height(1500)  replace


/* GENDER ______________________________________________________________________*/	

			/* define matrix */		

			import excel "${user}/pfm_ne_replication_rawoutput_main.xlsx", sheet(tA5_gender) firstrow clear

			destring lasso_coef l_lowb l_uppb, replace
			drop if variable == "ipv_rej_disobey"
			
			mkmat lasso_coef l_lowb l_uppb, mat(GENDER)
			matrix rownames GENDER =  	"Rejects intimate partner violence (control mean = 0.83)"						///
										"Thinks community rejects intimate partner violence (0.75)"							///
										"Would report intimate partner violence (0.56)"						///
										"Rejects early marriage (0.73)"			///
										"Thinks community rejects early marriage (0.63)" 				///
										"Shares anti-early marriage message (0.53)"				///
										"Rejects forced marriage (0.83)"			///
										"Gender equality attitudes index (0.67)"			///
										"Relationship satisfaction (0.61)"		///
										"Equal decision-making in relationships (0.93)"			///
										"Equal labor in relationships (0.29)"		

			/* generate coeffplot */
		
			matselrc GENDER X_GENDER , row(1/11)

			coefplot matrix(X_GENDER[,1]),  ///
											mcolor(black) ///
											ci((X_GENDER[,2] X_GENDER[,3]))  ///
											ciopts(lcolor(black)) ///
											xline(0) xscale(r(-0.15(0.05)0.20)) xlab(-0.15(0.05)0.2) xtitle("") ///
											graphregion(color(white)) ///
											bgcolor(white)  ///
											ytitle("")  yscale(noline alt) ///
											coeflabels(, notick labgap(-122)) ///
											graphregion(margin(l=60)) ///
											headings(	"Rejects intimate partner violence (control mean = 0.83)" = "{bf:Intimate Partner Violence}" ///
														"Rejects early marriage (0.73)" = "{bf:Early and Forced Marriage}" ///
														"Gender equality attitudes index (0.67)" = "{bf:Gender Equality and Relationships}", labgap(-122))  
											
					 graph export "${user}/f2_coefplot_gender_lasso.png", as(png) width(3500) height(1500)  replace

						
/* VALUES ______________________________________________________________________*/	

			/* define matrix */		

			import excel "${user}/pfm_ne_replication_rawoutput_main.xlsx", sheet(tA6_values) firstrow clear
			
			destring lasso_coef	l_lowb l_uppb, replace
			
			mkmat lasso_coef l_lowb l_uppb, mat(VALUES)
			matrix rownames VALUES =  	"Low prejudice index (control mean = 0.55)" 		///
										"Feeling thermometer towards outgroups (0.61)" 	///
										"Rejects violence against children (0.16)" 	///
										"Does not commit violence against children (0.62)" 	///
										"Religiosity (0.14)" 		///
										"Urbanism (0.18)" 

			/* generate coeffplot */
		
			matselrc VALUES X_VALUES , row(1/6)
			
			coefplot matrix(X_VALUES[,1]),  mcolor(black) ///
											ci((X_VALUES[,2] X_VALUES[,3]))  ///
											ciopts(lcolor(black)) ///
											xline(0) xscale(r(-0.15(0.05)0.20)) xlab(-0.15(0.05)0.2) xtitle("") ///
											graphregion(color(white)) ///
											bgcolor(white)  ///
											ytitle("")  yscale(noline alt) ///
											coeflabels(, notick labgap(-122)) ///
											graphregion(margin(l=60)) ///
											headings(	"Low prejudice index (control mean = 0.55)" = "{bf:Outgroup Tolerance}" ///
														"Rejects violence against children (0.16)" = "{bf:Violence Against Children}" ///
														"Religiosity (0.14)"  = "{bf:Religiosity and Urbanism}" , labgap(-122))  
											
					 graph export "${user}/f2_coefplot_values_lasso.png", as(png) width(3500) height(1500)  replace



						
